﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ECS_Test
{
    public abstract class System : ISystem
    {
        public System(CompTypes[] _requiredComponentTypes)
        {
            this.ACTs = _requiredComponentTypes;
            entities = new List<int>();
        }
        
        public CompTypes[] ACTs { get; set; }
        public List<int> entities { get; set; }

        public abstract void Update();

        public void Add(string[] _compTypes, int _id)
        {
            CompTypes[] ACTSasEnums = _compTypes.Select(x => Components.stringCompDict[x]).ToArray();

            if (ACTs.All(x => ACTSasEnums.Contains(x)))
            { entities.Add(_id); }
            else
                return;
        }
    }
}
